package com.yxt.common.sys;

import java.util.Locale;
import java.util.ResourceBundle;

public class LocalUtil {
	 private static final String MSG_LOCATION = "resources.message";

	    /**
	     * 获取相关国际化信息
	     * @param key 属性值
	     * @return 相关的国际化信息
	     */
	    public static String getMessage(String key) {
	        Locale locale = Locale.getDefault(); // 获得本地默认的国家
	        ResourceBundle bundle = ResourceBundle.getBundle(MSG_LOCATION, locale);
	        String msg = null;

	        try {
	            msg = bundle.getString(key); //获取相关的属性值
	        } catch (Exception ex) {
	            msg = key; //如果不存在些属性,则显示当前的KEY值
	        }

	        return msg;
	    }
}